﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>sample for DOM</title>
    <script type="text/javascript" src="../common/commonFuncs.js"></script>
</head>
<body>
    <p>
        wait to see the time</p>
    <script type="text/javascript">
        setTimeout(function () {
            var time = document.getElementById("time1");
            time.innerHTML = new Date().toString();
        }, 2000);

        setTimeout(function () {
            var time = document.getElementById("time2");
            if (!time.firstChild) {
                time.appendChild(document.createTextNode(new Date().toString()));
            } else {
                // printline("not empty");
                time.appendChild(document.createTextNode(new Date().toString()));
            }
        }, 3000);
        
        printline("hello");
    </script>
    <h1 id="time1">time1
    </h1>
    <h1 id="time2">time2
    </h1>
</body>
</html>
